/**
* @file CWWLog.h
* @brief The Uniform Log Class
*
* @author woodzheng
* @version 0.1
* @date 2007-06-30
* @bug
* @warning
*/
#ifndef CWWLOG_H_HEADER_INCLUDED_NEWASDASD8748278628465
#define CWWLOG_H_HEADER_INCLUDED_NEWASDASD8748278628465

#include <sys/types.h>
#include <unistd.h>
#include <stdint.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>

#include "c2cplatform/library/basic/singleton_t.h"
//#include "libc2c/sync_lock.h"

namespace c2cent{
    namespace library{
        namespace wwlog{

#define C2CWW_LOG_FILE_PATH "/usr/local/c2c/logs"
#define B2B2CWW_LOG_FILE_PATH "/data/log/b2b2c_cgi/"
#define B2B2CWW_LOG_WEBAPP_FILE_PATH "/data/webapps_log"
#define C2CWW_LOG_APP_FILE_PATH "/data/applog"
#define B2B2CWW_LOG_APP_FILE_PATH "/data/applog/"
const uint32_t C2CWW_LOG_FILE_NUM       = 10;
const uint32_t C2CWW_LOG_FILE_SIZE      = 10000000;
const uint32_t C2CWW_LOG_DEBUG_CTRL     = 1;
const uint32_t C2CWW_LOG_ERR_CTRL       = 1;
const uint32_t C2CWW_LOG_KEY_CTRL       = 1;
const uint32_t C2CWW_LOG_PATH_LEN       = 1024;
const uint32_t C2CWW_LOG_FORMAT_LEN     = 1024;
const uint32_t C2CWW_LOG_DATETIME_LEN   = 255;
const uint32_t C2CWW_LOG_SAFE_FILE_PATH_LEN = 70; //to keep it away from oi log bug, woodzheng 2008-04-12

enum WLOG_ROLLING_TYPE{
   WLOG_ROLLING_TYPE_BY_SIZE   =0,// rolling the log file if the current log file is full of the target size;
   WLOG_ROLLING_TYPE_BY_DATE   =1, // rolling the log file day by day
   WLOG_ROLLING_TYPE_BY_HOUR =2
};

enum WLOG_SWITCH{
   WLOG_CLOSE   =0x0,			//ȫ����־��
   WLOG_OPEN   =0x1,				//��־��
   WLOG_KEY_OPEN =0x2,			//KeyLog��		ǰ��ΪWLOG_OPEN
   WLOG_ERR_OPEN =0x4,			//ErrorLog��	ǰ��ΪWLOG_OPEN
   WLOG_PER_OPEN =0x8,			//PerformLog��	ǰ��ΪWLOG_OPEN
   WLOG_RUN_OPEN =0x10,		//RunLog��		ǰ��ΪWLOG_OPEN
   WLOG_DEG_OPEN =0x20,		//DebugLog��	ǰ��ΪWLOG_OPEN
   WLOG_ALL_OPEN =0xFF,			//ȫ����־��
};

const int RUNLOG_ROLLING_TYPE = 0;             // rolling the log file if the current log file is full of the target size;
const int RUNLOG_ROLLING_NUM  = 10;
const int RUNLOG_FILE_SIZE    = 1024*1024*20;  //20M


const int PERFORMLOG_ROLLING_TYPE = 3;             // rolling the log file if the current log file is full by days;
const int PERFORMLOG_ROLLING_NUM  = 10;
const int PERFORMLOG_FILE_SIZE    = 1024*1024*100;  //100M


const int KEYLOG_ROLLING_TYPE = 3;             //rolling the log file if the current log file is full by days;
const int KEYLOG_ROLLING_NUM  = 10;
const int KEYLOG_FILE_SIZE    = 1024*1024*100;  //100M


const int ERRLOG_ROLLING_TYPE  = 0;             // rolling the log file if the current log file is full of the target size;
const int ERRLOG_ROLLING_NUM   = 20;
const int ERRLOG_FILE_SIZE     = 1024*1024*40;  //40M


const int DEBUGLOG_ROLLING_TYPE = 0;             // rolling the log file if the current log file is full of the target size;
const int DEBUGLOG_ROLLING_NUM  = 10;
const int DEBUGLOG_FILE_SIZE    = 1024*1024*40;  //20M

const int BOSSLOG_ROLLING_TYPE = 3;             // rolling the log file if the current log file is full by days;
const int BOSSLOG_ROLLING_NUM  = 20;
const int BOSSLOG_FILE_SIZE    = 1024*1024*30;  //30M


const int WWLOG_UNKNOW_ERR_NUM  = 9999;

typedef struct tagSTLogNumConfig {
    int iRollingType;
    int iRollingNum;
    int iFileSize;
	bool bNeedRemote;

	tagSTLogNumConfig()
	: iRollingType(WLOG_ROLLING_TYPE_BY_SIZE)
	, iRollingNum(RUNLOG_ROLLING_NUM)
	, iFileSize(RUNLOG_FILE_SIZE)
	, bNeedRemote(false) {}
} STLogNumConfig;

class CLastErrLog
{
public:
	CLastErrLog()
	{
	}
	~CLastErrLog(){}
	const char * GetLastErrLog() const
	{
		return m_szLastErrLog;
	}
	const char * GetLastUem() const
	{
		return m_szLastUem;
	}
	void Init()
	{
		memset(m_szLastErrLog,0,sizeof(m_szLastErrLog));
		memset(m_szLastUem,0,sizeof(m_szLastUem));
	}
	void SetLastErrLog(char * sFormat,...)__attribute__((__format__ (__printf__, 2, 3)))
	{
		va_list ap;
		va_start(ap, sFormat);
		vsnprintf(m_szLastErrLog,sizeof(m_szLastErrLog),sFormat,ap);
		va_end(ap);
	}
	void SetLastUem(char * sFormat,...)__attribute__((__format__ (__printf__, 2, 3)))
	{
		va_list ap;
		va_start(ap, sFormat);
		vsnprintf(m_szLastUem,sizeof(m_szLastUem),sFormat,ap);
		va_end(ap);
	}
private:
	char m_szLastErrLog[C2CWW_LOG_FORMAT_LEN];
	char m_szLastUem[C2CWW_LOG_FORMAT_LEN];
};

typedef CSingletonT<CLastErrLog, CDummyLock> CLastErrLogSingleton;

#define LASTERRLOG c2cent::library::wwlog::CLastErrLogSingleton::Instance()

class CWWLog {
	public:
        /**
         * @fn CWWLog(const char * sLogName,const char * sBaseLogFilePath=C2CWW_LOG_FILE_PATH);
         * @brief CWWLog Class Constructor
         * @param sLogName Log File Name
         * @param sBaseLogFilePath Log File Base Path
         */
		CWWLog(const char * sLogName,const char * sBaseLogFilePath=C2CWW_LOG_FILE_PATH);
        CWWLog();
		~CWWLog();


        /*
         * �ⲿ�ֺ�����Ҫ��"��ʼ��"֮ǰ���ã�����ÿһ��log����־�ļ���������
         *
         * ע�⣺
         * ��������[5, 100]������ڣ���ʹ��Ĭ�ϵ�ֵ����������
         * */
        void SetRunLogRollingNum(int iRunLogRollingNum);
        void SetPerformLogRollingNum(int iPerformLogRollingNum);
        void SetErrLogRollingNum(int iErrLogRollingNum);
        void SetDebugLogRollingNum(int iDebugLogRollingNum);
        void SetKeyLogRollingNum(int iKeyLogRollingNum);

        /**
         * @fn int Init(const char * sLogName,const char * sBaseLogFilePath=C2CWW_LOG_FILE_PATH);
         * @brief CWWLog Initialize Method
         * @param sLogName Log File Name
         * @param pStPerformConfig perform log config
         * @param pStErrorConfig err log config
         * @param pStDebugConfig debug log config
         * @param pStKeyConfig key log config
         * @param pStRunConfig run log config
         */
        int Init(const char* pszLogName,const char* pszBaseLogFilePath=C2CWW_LOG_FILE_PATH,
                 STLogNumConfig* pStRunConfig = NULL,
                 STLogNumConfig* pStPerformConfig = NULL,
                 STLogNumConfig* pStErrorConfig = NULL,
                 STLogNumConfig* pStDebugConfig = NULL,
                 STLogNumConfig* pStKeyConfig = NULL);

        int QuickInitForAPP(const char* pszLogName,const char* pszBaseLogFilePath=C2CWW_LOG_APP_FILE_PATH, 
			bool bIsCanRemote = false,uint32_t dwLogSwitch=WLOG_OPEN|WLOG_KEY_OPEN|WLOG_ERR_OPEN);

        int QuickInitForAPP2(const char* pszLogName,const char* pszBaseLogFilePath=C2CWW_LOG_APP_FILE_PATH, 
			uint32_t dwRemoteLevel = 0,uint32_t dwLogSwitch=WLOG_OPEN|WLOG_KEY_OPEN|WLOG_ERR_OPEN);

        //dwPerformFileSize means 20 M
        int QuickInitForBig(const char* pszLogName,const char* pszBaseLogFilePath=C2CWW_LOG_APP_FILE_PATH, 
        		uint32_t dwRemoteLevel=1,uint32_t dwPerformFileSize=20,uint32_t dwLogSwitch=WLOG_OPEN|WLOG_ERR_OPEN);

        int QuickInitForCGI(const char* pszLogName,const char* pszBaseLogFilePath=C2CWW_LOG_FILE_PATH, 
			bool bIsCanRemote = false,uint32_t dwLogSwitch=WLOG_ALL_OPEN);
		
	 int QuickInitForFastAPP(const char* pszLogName,const char* pszBaseLogFilePath=C2CWW_LOG_APP_FILE_PATH, 
	 		bool bIsCanRemote = false,uint32_t dwLogSwitch=WLOG_OPEN|WLOG_ERR_OPEN);
	 
	 int QuickInitForFastCGI(const char* pszLogName,const char* pszBaseLogFilePath=C2CWW_LOG_FILE_PATH, 
	 		bool bIsCanRemote = false,uint32_t dwLogSwitch=WLOG_OPEN|WLOG_ERR_OPEN);

        /**
         * @fn void SetRunLogStatu(bool bIsNeed);
         * @brief Set the switch of recording the running log 
         * @param bIsNeed Switch Statu, true is for on, false is for off.
         */        
        void SetRunLogStatu(bool bIsNeed);

        /**
         * @fn void SetPerformLogStatu(bool bIsNeed);
         * @brief Set the switch of recording the perform log 
         * @param bIsNeed Switch Statu, true is for on, false is for off.
         */              
        void SetPerformLogStatu(bool bIsNeed);

        /**
         * @fn void SetErrLogStatu(bool bIsNeed);
         * @brief Set the switch of recording the error log 
         * @param bIsNeed Switch Statu, true is for on, false is for off.
         */              
        void SetErrLogStatu(bool bIsNeed);

        /**
         * @fn void SetDebugLogStatu(bool bIsNeed);
         * @brief Set the switch of recording the debug log 
         * @param bIsNeed Switch Statu, true is for on, false is for off.
         */              
        void SetDebugLogStatu(bool bIsNeed);

        /**
         * @fn void SetKeygStatu(bool bIsNeed);
         * @brief Set the switch of recording the key log 
         * @param bIsNeed Switch Statu, true is for on, false is for off.
         */              
        void SetKeygStatu(bool bIsNeed);             


	 bool IsRunLogOpen() const;
        bool IsPerformLogOpen() const;
        bool IsErrLogOpen() const;
        bool IsDebugLogOpen() const;
        bool IsKeyLogOpen() const;
        
         /**
         * @fn void LogRunMsg(const char * sFormat,...);
         * @brief ��ˮlog
         * @param sFormat Log Content Format
         * @param ... content param list 
         */ 
        void LogRunMsg(char * sFormat,...)__attribute__((__format__ (__printf__, 2, 3)));

         /**
         * @fn void LogDebugMsg(const char * sFormat,...);
         * @brief ����log
         * @param sFormat Log Content Format
         * @param ... content param list 
         */          
        void LogDebugMsg(char * sFormat,...)__attribute__((__format__ (__printf__, 2, 3)));

	 /**
		  * @fn void LogDebugMsg_byDir(const char * sFormat,...);
		  * @brief �ڱ��ذ����ڷ�Ŀ¼�洢
		  * @param sFormat Log Content Format
		  * @param ... content param list 
		  */		  
		void LogDebugMsgByDir(char * sFormat,...)__attribute__((__format__ (__printf__, 2, 3)));

     /**
         * @fn void LogErrMsg(const char * sFormat,...);
         * @brief ����log
         * @param sFormat Log Content Format
         * @param ... content param list 
         */          
        void LogErrMsg(char * sFormat,...)__attribute__((__format__ (__printf__, 2, 3)));

         /**
         * @fn void LogPerformMsg(const char * sFormat,...);
         * @brief ����log
         * @param sFormat Log Content Format
         * @param ... content param list 
         */          
        void LogPerformMsg(char * sFormat,...)__attribute__((__format__ (__printf__, 2, 3)));


         /**
         * @fn void LogKeyMsg(const char * sFormat,...);
         * @brief ��Ӫlog
         * @param sFormat Log Content Format
         * @param ... content param list 
         */          
        void LogKeyMsg(char * sFormat,...)__attribute__((__format__ (__printf__, 2, 3)));
		 
	const char* GetLastLog() const
	{
		return m_sFormat;
	}

	private:
		const char* GetDateTime(char *sDateTime, uint32_t dwSize);
    
    private:
        bool m_bRunLogIsNeed;
        bool m_bPerformLogIsNeed;
        bool m_bErrLogIsNeed;
        bool m_bDebugLogIsNeed;
        bool m_bKeyLogIsNeed;

        int m_iRunLogRollingNum;
        int m_iPerformLogRollingNum;
        int m_iErrLogRollingNum;
        int m_iDebugLogRollingNum;
        int m_iKeyLogRollingNum;

		char m_sFormat[C2CWW_LOG_FORMAT_LEN];
		char m_sDateTimeBuffer[C2CWW_LOG_DATETIME_LEN];

		char m_sLogSvcName[C2CWW_LOG_PATH_LEN];
};


#define C2CWW_LOG_ERR_INFO_FORMAT        "FILE:%s LN:%d FUN:%s EN:%d EM:"
#define C2CWW_LOG_DEBUG_INFO_FORMAT      "FILE:%s LN:%d FUN:%s EM:"
#define C2CWW_LOG_DEBUG_INFO_CONTENT     __FILE__,__LINE__,__func__
#define C2CWW_LOG_BOSS_INFO_FORMAT       "FILE:%s LN:%d FUN:%s Protocol:%s RemoteIp:%s BossName:%s Source:%s RouterUin:%d "



#define C2C_KLOG_START "start"
#define C2C_KLOG_END   "end"

#define UEM_BEGIN "[!^UEM|"
#define UEM_END   "|^!]"

//for singleton use, in service.
typedef CSingletonT<CWWLog, CDummyLock> CWWLogSingleton;

#define C2C_WWLOG c2cent::library::wwlog::CWWLogSingleton::Instance()


#ifndef __C2C_WWLOG_COMPILETEST__  //for compile check ,if you want to check your code, please compile with -D__C2C_WWLOG_COMPILETEST__

    #define C2C_WW_LOG(sformat,args...)do{\
        C2C_WWLOG->LogRunMsg(sformat,##args);\
    }while(0)

    #define C2C_WW_LOG_ERR(ErrCode,sformat,args...)do{\
	LASTERRLOG->SetLastErrLog(C2CWW_LOG_ERR_INFO_FORMAT sformat,C2CWW_LOG_DEBUG_INFO_CONTENT,ErrCode, ##args);\
        C2C_WWLOG->LogErrMsg(C2CWW_LOG_ERR_INFO_FORMAT sformat,C2CWW_LOG_DEBUG_INFO_CONTENT,ErrCode, ##args);\
    }while(0)

    #define C2C_WW_LOG_ERR_ITIL(ErrCode,ItilID,sformat,args...)do{\
        Attr_API2(ItilID,1);\
        LASTERRLOG->SetLastErrLog(C2CWW_LOG_ERR_INFO_FORMAT sformat,C2CWW_LOG_DEBUG_INFO_CONTENT,ErrCode, ##args);\
        C2C_WWLOG->LogErrMsg(C2CWW_LOG_ERR_INFO_FORMAT sformat,C2CWW_LOG_DEBUG_INFO_CONTENT,ErrCode, ##args);\
    }while(0)

    #define C2C_WW_LOG_LAST_ERR_LOG(strlasterrlog)do{\
		strlasterrlog=LASTERRLOG->GetLastErrLog();\
    }while(0)

	#define C2C_WW_LOG_APPEND_UEM(strlasterrlog,sformat,args...)do{\
		LASTERRLOG->SetLastUem(" %s" sformat "%s",UEM_BEGIN,##args,UEM_END);\
		strlasterrlog+=LASTERRLOG->GetLastUem();\
    }while(0)

    #define C2C_WW_LOG_DEBUG(sformat,args...)do{\
        C2C_WWLOG->LogDebugMsg(C2CWW_LOG_DEBUG_INFO_FORMAT sformat,C2CWW_LOG_DEBUG_INFO_CONTENT, ##args);\
    }while(0)

	#define C2C_WW_LOG_DEBUG_BY_DIR(sformat,args...)do{\
        C2C_WWLOG->LogDebugMsgByDir(C2CWW_LOG_DEBUG_INFO_FORMAT sformat,C2CWW_LOG_DEBUG_INFO_CONTENT, ##args);\
    }while(0)

    #define C2C_WW_LOG_PERFORM(sformat,args...)do{\
        C2C_WWLOG->LogPerformMsg(sformat,##args);\
    }while(0)

	#define C2C_WW_LOG_KEY(sformat,args...)do{\
        C2C_WWLOG->LogKeyMsg(sformat,##args);\
    }while(0)

    #define C2CWW_LOG_KEY_INFO_FORMAT_V6  "bin=%s||cid=0x%x||fileinfo=%s::%s::%d||opuin=%u||skey=%s||src=%s||uip=%s||mkey=%s||dealid=%s||itemid=%s||%s||@@||"
    #define C2C_WW_LOG_FKEY_PL35_V6(BinName,rCntlInfo,strSource,strIp,strMachineKey,sDealId,sItemId,sMark,sformat,args...)\
        C2C_WWLOG->LogKeyMsg( C2CWW_LOG_KEY_INFO_FORMAT_V6 sformat, BinName,rCntlInfo.getCmdId(), __FILE__,__FUNCTION__,__LINE__,rCntlInfo.getOperatorUin(),\
                              rCntlInfo.getOperatorKey().c_str(),strSource.c_str(),\
                              strIp.c_str(),strMachineKey.c_str(),sDealId.c_str(),sItemId.c_str(),sMark,\
                          ##args);\

    #define C2CWW_LOG_KEY_INFO_FORMAT_V5  "bin=%s||fileinfo=%s::%s::%d||opuin=%u||src=%s||uip=%s||mkey=%s||dealid=%s||itemid=%s||%s||@@||"
    #define C2C_WW_LOG_FKEY_PL35_V5(BinName,dwOperatorUin,strSource,strIp,strMachineKey,sDealId,sItemId,sMark,sformat,args...)\
        C2C_WWLOG->LogKeyMsg( C2CWW_LOG_KEY_INFO_FORMAT_V5 sformat, BinName, __FILE__,__FUNCTION__,__LINE__,dwOperatorUin,\
                              strSource.c_str(),\
                              strIp.c_str(),strMachineKey.c_str(),sDealId.c_str(),sItemId.c_str(),sMark,\
                          ##args);\

    #define C2CWW_LOG_ERR_INFO_FORMAT_V6  "opresult=%d||bin=%s||cid=0x%x||fileinfo=%s::%s::%d||opuin=%u||skey=%s||src=%s||uip=%s||mkey=%s||dealid=%s||itemid=%s||@@||"                            
    #define C2C_WW_LOG_FERR_PL35_V6(ErrCode,BinName,rCntlInfo,strSource,strIp,strMachineKey,sDealId,sItemId,sformat,args...)do{\
        LASTERRLOG->SetLastErrLog(C2CWW_LOG_ERR_INFO_FORMAT_V6 sformat, ErrCode, BinName,rCntlInfo.getCmdId(), __FILE__,__FUNCTION__,__LINE__,rCntlInfo.getOperatorUin(),\
                                rCntlInfo.getOperatorKey().c_str(), strSource.c_str(),\
                                strIp.c_str(),strMachineKey.c_str(),sDealId.c_str(),sItemId.c_str(),\
                                ##args);\
        C2C_WWLOG->LogErrMsg(C2CWW_LOG_ERR_INFO_FORMAT_V6 sformat, ErrCode, BinName,rCntlInfo.getCmdId(),__FILE__,__FUNCTION__,__LINE__,rCntlInfo.getOperatorUin(),\
                                rCntlInfo.getOperatorKey().c_str(),strSource.c_str(),\
                                strIp.c_str(),strMachineKey.c_str(),sDealId.c_str(),sItemId.c_str(),\
                                ##args);\
    }while(0)
    
    #define C2CWW_LOG_ERR_INFO_FORMAT_V5  "opresult=%d||bin=%s||fileinfo=%s::%s::%d||opuin=%u||src=%s||uip=%s||mkey=%s||dealid=%s||itemid=%s||@@||"                            
    #define C2C_WW_LOG_FERR_PL35_V5(ErrCode,BinName,dwOperatorUin,strSource,strIp,strMachineKey,sDealId,sItemId,sformat,args...)do{\
        LASTERRLOG->SetLastErrLog(C2CWW_LOG_ERR_INFO_FORMAT_V5 sformat, ErrCode, BinName, __FILE__,__FUNCTION__,__LINE__,dwOperatorUin,\
                                strSource.c_str(),\
                                strIp.c_str(),strMachineKey.c_str(),sDealId.c_str(),sItemId.c_str(),\
                                ##args);\
        C2C_WWLOG->LogErrMsg(C2CWW_LOG_ERR_INFO_FORMAT_V5 sformat, ErrCode, BinName, __FILE__,__FUNCTION__,__LINE__,dwOperatorUin,\
                                strSource.c_str(),\
                                strIp.c_str(),strMachineKey.c_str(),sDealId.c_str(),sItemId.c_str(),\
                                ##args);\
    }while(0)
    

    #define C2CWW_LOG_KEY_INFO_FORMAT  "bin=%s||fun=%s||cid=0x%x||file=%s||line=%d||opuin=%u||skey=%s||src=%s||uip=%s||mkey=%s||%s||@@||"


    #define C2CWW_LOG_KEY_INFO_FORMAT_V4  "bin=%s||fun=%s||cid=0x%x||file=%s||line=%d||opuin=%u||skey=%s||src=%s||uip=%08X||mkey=%s||%s||@@||"

    #define C2C_WW_LOG_FKEY_PL35_V4(BinName,rCntlInfo,strSource,strMachineKey,sMark,sformat,args...)\
        C2C_WWLOG->LogKeyMsg(C2CWW_LOG_KEY_INFO_FORMAT_V4 sformat,BinName,__FUNCTION__,rCntlInfo.getCmdId(),__FILE__,__LINE__,rCntlInfo.getOperatorUin(),\
                              rCntlInfo.getOperatorKey().c_str(),strSource.c_str(),\
                              rCntlInfo.getOperatorClientIP(),strMachineKey.c_str(),sMark,##args);

    #define C2C_WW_LOG_FKEY_PL35_V3(BinName,dwCmdId,rCntlInfo,zSource,zIp,zMachineKey,sMark,sformat,args...)\
        C2C_WWLOG->LogKeyMsg( C2CWW_LOG_KEY_INFO_FORMAT sformat, BinName,__FUNCTION__,dwCmdId, __FILE__,__LINE__,rCntlInfo.getOperatorUin(),\
                              rCntlInfo.getOperatorKey().c_str(),zSource,\
                              zIp,zMachineKey,sMark,\
                              ##args);\

    #define C2C_WW_LOG_FKEY_PL35_V2(BinName,dwCmdId,rCntlInfo,zSource,strIp,zMachineKey,sMark,sformat,args...)\
        C2C_WWLOG->LogKeyMsg( C2CWW_LOG_KEY_INFO_FORMAT sformat, BinName,__FUNCTION__,dwCmdId, __FILE__,__LINE__,rCntlInfo.getOperatorUin(),\
                              rCntlInfo.getOperatorKey().c_str(),zSource,\
                              strIp.c_str(),zMachineKey,sMark,\
                              ##args);\

    #define C2C_WW_LOG_FKEY_PL35(BinName,dwCmdId,rCntlInfo,strSource,strIp,strMachineKey,sMark,sformat,args...)\
        C2C_WWLOG->LogKeyMsg( C2CWW_LOG_KEY_INFO_FORMAT sformat, BinName,__FUNCTION__,dwCmdId, __FILE__,__LINE__,rCntlInfo.getOperatorUin(),\
                              rCntlInfo.getOperatorKey().c_str(),strSource.c_str(),\
                              strIp.c_str(),strMachineKey.c_str(),sMark,\
                              ##args);\

    #define C2C_WW_LOG_FKEY_PL3(BinName,oCmd,strIp,function,sMark,sformat,strMachineKey,args...)\
        C2C_WWLOG->LogKeyMsg( C2CWW_LOG_KEY_INFO_FORMAT sformat, BinName,function,oCmd.getCmdId(), __FILE__,__LINE__,oCmd.getOperatorUin(),\
                              oCmd.getOperatorKey().c_str(),"",\
                              strIp.c_str(),strMachineKey.c_str(),sMark,\
                              ##args);\

    #define C2C_WW_LOG_FKEY_PL1(BinName,oAuthInfo,strIp,function,sMark,sformat,args...)\
        C2C_WWLOG->LogKeyMsg( C2CWW_LOG_KEY_INFO_FORMAT sformat, BinName,function,0, __FILE__,__LINE__,oAuthInfo.getOperatorUin(),\
                              oAuthInfo.getOperatorKey().c_str(),"",\
                              strIp.c_str(),"",sMark,\
                              ##args);\

    #define C2C_WW_LOG_FKEY_BOSS_PL1(BinName,oAuthInfo,strIp,oFilter,sMark,sformat,args...)\
        C2C_WWLOG->LogKeyMsg( C2CWW_LOG_KEY_INFO_FORMAT sformat, BinName,__FUNCTION__,0, __FILE__,__LINE__,oAuthInfo.getOperatorUin(),\
                              oAuthInfo.getOperatorKey().c_str(),oFilter.GetSource().c_str(),\
                              strIp.c_str(),"",sMark,\
                              ##args);\


#else

    #define C2C_WW_LOG(sformat,args...)do{\
        printf(sformat,##args);\
    }while(0)

    #define C2C_WW_LOG_ERR(ErrCode,sformat,args...)do{\
        printf(C2CWW_LOG_ERR_INFO_FORMAT sformat,C2CWW_LOG_DEBUG_INFO_CONTENT,ErrCode, ##args);\
    }while(0)

    #define C2C_WW_LOG_DEBUG(sformat,args...)do{\
        printf(C2CWW_LOG_DEBUG_INFO_FORMAT sformat,C2CWW_LOG_DEBUG_INFO_CONTENT, ##args);\
    }while(0)

    #define C2C_WW_LOG_PERFORM(sformat,args...)do{\
        printf(sformat,##args);\
    }while(0)

	#define C2C_WW_LOG_KEY(sformat,args...)do{\
        printf(sformat,##args);\
    }while(0)

#endif



//start the simple log define
#define C2C_WW_SIM_LOG_PL_HEAD()\
    C2C_WW_LOG("\n\n======== %s REQUEST START cptime:[ %s %s ] ========",__FUNCTION__,__DATE__,__TIME__)

};
   
};
};
#endif /* CLOGINFO_H_HEADER_INCLUDED_BB9F6472 */






